﻿using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;

namespace MainApplication.DataEntry
{
    public class Student
    {
        [Key] // 指定主键
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)] // 自增
        public int StudentId { get; set; }

        [Required] // 非空约束
        [MaxLength(50)] // 最大长度
        public string Name { get; set; } = string.Empty;

        [Required]
        [MaxLength(10)]
        public string Gender { get; set; } = string.Empty;

        // 可选：重写ToString方法便于调试
        public override string ToString()
        {
            return $"学号：{StudentId}，姓名：{Name}，性别：{Gender}";
        }
    }

    }
}
